Refactor print to support arbitrary tensor dimensions#1193
Conversation
Greptile SummaryThis PR replaces the hard-coded rank-3 and rank-4 print loops in
Confidence Score: 5/5Safe to merge — the refactor is self-contained to the print subsystem, all three format paths are verified by exact-string tests for the new 5-D case, and the 3-D/4-D test suite continues to validate backward-compatible output. The generic recursive helpers produce output that is character-for-character identical to the removed hand-rolled loops for ranks 3 and 4, as confirmed by the existing exact-match tests. The new helpers extend cleanly to rank 5+, covered by three new exact-output tests. No incorrect indexing, off-by-one, or dangling-reference issues were found during detailed tracing of the template recursion and indentation logic. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["InternalPrint"] --> B{sizeof Args}
B -->|0| C["PrintVal scalar"]
B -->|1| D["1-D loop"]
B -->|2| E["2-D loop"]
B -->|3+| F["GetPrintExtents"]
F --> G{PRINT_FORMAT_TYPE}
G -->|DEFAULT| H["PrintDefaultSlices"]
G -->|MLAB| I["PrintMlabCat"]
G -->|PYTHON| J["PrintPythonRecursive"]
Reviews (2): Last reviewed commit: "Add MlabTest5D and PythonTest5D PrintTes..." | Re-trigger Greptile |
|
/build |
No description provided.